package com.atguigu.day02;

import java.util.ArrayList;
import java.util.UUID;

//线程不安全例子
public class NotSafeDemo {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
//        List<String> list = new Vector<>();

             for (int i = 0; i < 100; i++) {
                 new Thread(() -> {
//                 list.add("a");
                 list.add(UUID.randomUUID().toString().substring(1,7));
                 System.out.println(list);

                 }, "A").start();
             }
    }
}
